import React from 'react'
// ===================================================================== Temp
import FormModal from '#cpt/temp/FormModal'
// ===================================================================== global declare
const { $fn, $Lazy } = window
// ===================================================================== Lazy
const $cache 	= $Lazy.file(()=>import('#private/cache-api'))
// ===================================================================== component
class Index extends React.Component{
	state = {
		data:[],
		pag: {},
		selectedKeys:[],
		//修改账期
		formData:[
			{ label: '物价分类',		name: 'dist_code', 	type: 'select', full:true,	loading:true, idStr:'code' },
		]
	}
	submit = {}
	model = {}
	
	open = (data) => {
		let uuids = []
		data.forEach(v=>{
			uuids.push(v.uuid)
		})
		this.submit = {is_dist:1,uuids}
		this.modal.open({ formRef:this.formRef })
		this.getModalSelect()
	}

	// 获取弹窗下拉框数据
	getModalSelect = async () => {
		const { formData } = this.state
		$fn.setModalRows(formData, 'dist_code', ()=>{
			$cache.then( async f => {
				// 物价分类
				$fn.setRow(formData, 'dist_code', await f.getDicCache({ code: 89000 }))
				//
				this.setState({ formData })
			})
		})
	}
	
	render(){
		return FormModal.call(this,{ title:'设置物价分类', api: 'qt-item-hospital/itemattraddbybatch' })
	}
}

export default Index